/*
 * CUDAVec.cuh
 *
 *  Created on: Jul 25, 2013
 *      Author: jaime
 */

#ifndef CUDAVEC_H_
#define CUDAVEC_H_

#include "../SATSolver/SolverTypes.cuh"
#include <vector>
#include <assert.h>
#include "../SATSolver/Configs.cuh"
using namespace std;

class CUDAClauseVec {

private:
	int capacity;
	int size;
	Clause* clauses_dev;

public:
	__host__ CUDAClauseVec(int capacity);
	__host__ __device__ virtual ~CUDAClauseVec();
	__host__ __device__ int size_of();
	__host__ __device__ bool add(Clause &c);
	__device__ bool remove(int pos);
	__host__ __device__ Clause get(int pos);
	__device__ Clause* get_ptr(int pos);
	__host__ __device__ void print_all();
	/**
	 * Allocate one continuous space in the device to store all clauses in vec and
	 * copies them to it, adding their reference to this object.
	 */
	__host__ void alloc_and_copy_to_dev(vector<Clause> & vec);
};

__global__ void print_dev(CUDAClauseVec vec);

#endif /* CUDAVEC_H_ */
